﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//using _180FrameWork.Common;

namespace _180FrameWork.CustControls
{
    public partial class CustNumericUpDown : NumericUpDown, ICustControl
    {
        private bool _IsBind = false;
        public bool IsBind { get { return this._IsBind; } protected set { this._IsBind = value; } }

        private string _PropertName = "";
        public string PropertName { get { return this._PropertName; } set { this._PropertName = value; } }

        //private string _QueryName = "";
        //public string QueryName { get { return this._QueryName; } set { this._QueryName = value; } }

        public CustNumericUpDown()
        {
            InitializeComponent();
        }

        public void SetValue(object strValue)
        {
            this.Value = decimal.Parse(strValue.ToString());
        }

        public object GetValue()
        {
            return this.Value;
        }

        public void Binding(object DataSource, string DataMember)
        {
            this.DataBindings.Add("Value", DataSource, DataMember);
            IsBind = true;
        }

        public void Clean()
        {
            this.Value = 0;
        }

        public void GetFocus()
        {
            base.Focus();
        }

        private void Control_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{TAB}");
            }
        }
    }
}
